package elcs.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import elcs.board.model.BoardService;
import elcs.board.model.BoardVO;
import elcs.board.model.ListVO;

@Controller
public class BoardController {
	@Resource(name="boardServiceImpl")
	private BoardService boardService;
	
	@RequestMapping("/board/view.do")
	public ModelAndView getViewList(BoardVO bvo,HttpServletRequest request) throws Exception{
		ModelAndView mv=new ModelAndView();
		//System.out.println(bvo.getHead()+"  "+);
		String pageNo=request.getParameter("pageNo");
		
		Map map=new HashMap();
		map.put("head", bvo.getHead());
		map.put("pageNo", pageNo);
		String type=request.getParameter("type");
		System.out.println(type+"<-con");
		ListVO lvo=boardService.getViewList(map);
		
		if(type.equals("reply")){
			mv.addObject("lvo",lvo);
			mv.setViewName("reply/list.board");
		}else if(type.equals("basic")){
			
		}else if(type.equals("answer")){
			
		}
		return mv;
	}
	

}
